package com.wty.cmims.controller;

import com.wty.cmims.pojo.ResponseResult;
import com.wty.cmims.service.SystemConfigService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.media.Content;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/system")
@Tag(name = "系统公告", description = "社区医疗信息后台管理系统api接口")
public class SystemConfigController {
    @Autowired
    private SystemConfigService systemConfigService;

    // 获取系统公告
    @PostMapping("/findAnnouncement")
    @Operation(summary = "获取系统公告", description = "获取系统公告")
    @ApiResponse(description = "处理结果",content = {
            @Content(
                    mediaType="application/json",
                    schema= @Schema(implementation = ResponseResult.class)
            )
    })
    public ResponseResult<String> findAnnouncement(){
        return systemConfigService.findAnnouncement();
    }

    // 修改系统公告
    @PostMapping("/updateAnnouncement")
    @Operation(summary = "修改系统公告", description = "权限启停")
    @Parameter(name = "announcement",description = "参数列表")
    @ApiResponse(description = "处理结果",content = {
            @Content(
                    mediaType="application/json",
                    schema= @Schema(implementation = ResponseResult.class)
            )
    })
    public ResponseResult<Void> updateAnnouncement(@RequestParam String announcement){
        return systemConfigService.updateAnnouncement(announcement);
    }
}